-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Kibana API endpoint for histogram chart data #70976
Conversation
…r all data fetching.
038cbc0
to
3f45214
Compare
Pinging @elastic/ml-ui (:ml) |
export const dataVisualizerFieldHistogramsSchema = schema.object({ | ||
/** Query to match documents in the index. */ | ||
query: schema.any(), | ||
fields: schema.arrayOf(schema.any()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - can you add some sort of comment for fields
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in b794e97.
samplerShardSize, | ||
}); | ||
|
||
return httpService.http<any>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am repeatedly seeing this error the first time I try to view the histograms in the Transforms wizard.
The workflow I use is:
- Open the ML plugin. Switch to the Data Frame Analytics page.
- Starting creating a DFA job, and view the histograms for the source data.
- Then switch to the Transform page in Stack Management.
- Create a transform, and click the Histogram charts button
Once in the Transforms wizard, if I then do a browser refresh, the charts then start working as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested latest edit with 84203df and this fixes the issue with http
for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peteharverson It turned out having the endpoint only as part of the ML plugin doesn't guarantee that it's available when the transform plugin loads. To avoid a runtime dependency between the transforms and ML plugin (which would mean adding ML to transforms' kibana.json
) I duplicated the API endpoint so each plugin has their own endpoint to get the histogram data. Both plugins still share the code to created the server side aggregations. The update is in
a117e43, please have another look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested latest edits against a variety of indexes and LGTM.
@elasticmachine merge upstream |
color="text" | ||
onClick={toggleChartVisibility} | ||
> | ||
{i18n.translate('xpack.ml.dataGrid.histogramButtonText', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we use FormattedMessage
in templates?
.../ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts
Outdated
Show resolved
Hide resolved
.../pages/analytics_exploration/components/exploration_results_table/use_exploration_results.ts
Outdated
Show resolved
Hide resolved
@@ -107,7 +108,7 @@ export const Page: FC = () => { | |||
autoRefreshSelector: true, | |||
}); | |||
|
|||
const dataLoader = new DataLoader(currentIndexPattern, kibanaConfig); | |||
const dataLoader = new DataLoader(currentIndexPattern, getToastNotifications()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid usting cached getToastNotifications
and retriveve toastNotifications
from the kibana context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the file uses the same approach and I didn't plan to refactor it in this PR.
...ame_analytics/pages/analytics_exploration/components/outlier_exploration/use_outlier_data.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts
Show resolved
Hide resolved
// TODO Temporary fix to make the Data Grid Histograms in the Transforms Wizard work | ||
setDependencyCache({ | ||
http: appDependencies.http, | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can avoid this temp fix without significant refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 3306ff8.
@darnautov addressed your comments, tests passed, please have another look. |
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Introduces dedicated Kibana API endpoints as part of ML and transform plugin API endpoints and moves the logic to query and transform the required data from client to server. - Adds support for sampling to retrieve the data for the field histograms. For now this is not configurable by the end user and is hard coded to 5000. This is to have a first iteration of this functionality in for 7.9 and protect users when querying large clusters. The button to enable the histogram charts now includes a tooltip that mentions the sampler.
- Introduces dedicated Kibana API endpoints as part of ML and transform plugin API endpoints and moves the logic to query and transform the required data from client to server. - Adds support for sampling to retrieve the data for the field histograms. For now this is not configurable by the end user and is hard coded to 5000. This is to have a first iteration of this functionality in for 7.9 and protect users when querying large clusters. The button to enable the histogram charts now includes a tooltip that mentions the sampler. Co-authored-by: Elastic Machine <[email protected]>
* master: (21 commits) [Maps] 7.9 design improvements (elastic#71563) [ML] Changing all calls to ML endpoints to use internal user (elastic#70487) [eventLog] prevent log writing when initialization fails (elastic#71339) [Observability] landing page always being displayed (elastic#71494) [IM] Address data stream copy feedback (elastic#71615) [Logs UI] Anomalies page dataset filtering (elastic#71110) [data.search.aggs] Remove `use_field_mapping` from top hits agg (elastic#71168) [ML] Anomaly swim lane embeddable navigation and filter actions (elastic#71082) Fixes typo in siem_cloudtrail job description (elastic#71569) Require granted API Keys to have a name (elastic#71623) Update getUsageForCollection (elastic#71609) Only fetch saved elements once (elastic#71310) [SecuritySolution][Resolver] Adding siem index and guarding process ancestry (elastic#71570) [APM] Additional data telemetry changes (elastic#71112) [Visualize] Fix export table for table export links (elastic#71249) [Search] Server side search API (elastic#70446) use inclusive language (elastic#71607) [Security Solution] Hide timeline footer when Resolver is open (elastic#71516) [Index template wizard] Remove shadow and use border for components panels (elastic#71606) [ML] Kibana API endpoint for histogram chart data (elastic#70976) ...
Summary
Part of #69235.
5000
. This is to have a first iteration of this functionality in for7.9
and protect users when querying large clusters. The button to enable the histogram charts now includes a tooltip that mentions the sampler.Todos
Checklist
For maintainers